<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<title>XiunoPHP 开发手册</title>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<meta name="keywords" content="XiunoPHP 开发手册" />
	<meta name="description" content="XiunoPHP 开发手册 " />
	<meta name="generator" content="Xiuno BBS" />
	<meta name="author" content="Xiuno Team" />
	<meta name="copyright" content="2008-2012 xiuno.com" />
	<meta name="MSSmartTagsPreventParsing" content="True" />
	<meta http-equiv="MSThemeCompatible" content="Yes" />
	<link href="common.css" type="text/css" rel="stylesheet" />
</head>
<body  class="bg1">
	<div class="width big">
		<h1>utf8.class.php</h1>
		<p>utf8 字符操作的静态类</p>
		<ol>
			<li><b>utf8::substr</b>($str, $offset, $length = NULL) 实例：
<pre>
// 中英文字符串截取，不出现乱码
$s = utf8::substr('abcdefg中文', 1, -1);
</pre>
			</li>
		
			<li><b>utf8::safe_substr</b>($str, $offset, $length = NULL) 实例：
<pre>
// 安全截取，防止SQL注射
$s = utf8::safe_substr($str, $offset, $length = NULL);
</pre>
			</li>
			
			<li><b>utf8::is_ascii</b>($str) 实例：
<pre>
// 判断字符串是否是ascii编码
$bool = utf8::is_ascii('abcdefg');
</pre>
			</li>
			
			<li><b>utf8::strlen</b>($str) 实例：
<pre>
// 判断字符串的长度
$n = utf8::strlen('abcdefg');
</pre>
			</li>
				
		</ol>
	</div>
</body>
</html>
